﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="courseManage.aspx.cs" Inherits="学生成绩查询及选课系统.admin.courseManage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <br />
        <asp:Label ID="Label1" runat="server" Text="课程号:"></asp:Label>
&nbsp;
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="查找" />
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="cno" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="315px" OnRowCommand="GridView1_RowCommand" Width="1000px">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="cno" HeaderText="课程号" InsertVisible="False" ReadOnly="True" SortExpression="cno" />
                <asp:BoundField DataField="cname" HeaderText="课程名" SortExpression="cname" />
                <asp:BoundField DataField="tno" HeaderText="教师号" SortExpression="tno" />
                <asp:BoundField DataField="credit" HeaderText="学分" SortExpression="credit" />
                <asp:BoundField DataField="cproperties" HeaderText="课程性质" SortExpression="cproperties" />
                <asp:BoundField DataField="cCount" HeaderText="课程数量" SortExpression="cCount" />
                <asp:BoundField DataField="cstate" HeaderText="课程状况" SortExpression="cstate" />
                <asp:CommandField ShowEditButton="True" />
                <asp:ButtonField CommandName="Insert" Text="添加" />
            </Columns>
            <EditRowStyle BackColor="#7C6F57" />
            <EmptyDataTemplate>
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4" DataKeyNames="cno" DataSourceID="SqlDataSource1" DefaultMode="Insert" GridLines="Horizontal" Height="50px" OnItemCommand="DetailsView1_ItemCommand" OnItemInserted="DetailsView1_ItemInserted" Width="400px">
                    <EditRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
                    <Fields>
                        <asp:BoundField DataField="cno" HeaderText="课程号" InsertVisible="False" ReadOnly="True" SortExpression="cno" />
                        <asp:BoundField DataField="cname" HeaderText="课程名" SortExpression="cname" />
                        <asp:BoundField DataField="tno" HeaderText="教师号" SortExpression="tno" />
                        <asp:BoundField DataField="credit" HeaderText="学分" SortExpression="credit" />
                        <asp:BoundField DataField="cproperties" HeaderText="课程性质" SortExpression="cproperties" />
                        <asp:BoundField DataField="cCount" HeaderText="课程数量" SortExpression="cCount" />
                        <asp:BoundField DataField="cstate" HeaderText="课程状况" SortExpression="cstate" />
                        <asp:CommandField ShowInsertButton="True" />
                    </Fields>
                    <FooterStyle BackColor="White" ForeColor="#333333" />
                    <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="White" ForeColor="#333333" />
                </asp:DetailsView>
            </EmptyDataTemplate>
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:C#StuentManageConnectionString %>" DeleteCommand="DELETE FROM [course] WHERE [cno] = @cno" InsertCommand="INSERT INTO [course] ([cname], [tno], [credit], [cproperties], [cCount], [cstate]) VALUES (@cname, @tno, @credit, @cproperties, @cCount, @cstate)" SelectCommand="SELECT * FROM [course]" UpdateCommand="UPDATE [course] SET [cname] = @cname, [tno] = @tno, [credit] = @credit, [cproperties] = @cproperties, [cCount] = @cCount, [cstate] = @cstate WHERE [cno] = @cno">
            <DeleteParameters>
                <asp:Parameter Name="cno" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="cname" Type="String" />
                <asp:Parameter Name="tno" Type="Int32" />
                <asp:Parameter Name="credit" Type="Int32" />
                <asp:Parameter Name="cproperties" Type="String" />
                <asp:Parameter Name="cCount" Type="Int32" />
                <asp:Parameter Name="cstate" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="cname" Type="String" />
                <asp:Parameter Name="tno" Type="Int32" />
                <asp:Parameter Name="credit" Type="Int32" />
                <asp:Parameter Name="cproperties" Type="String" />
                <asp:Parameter Name="cCount" Type="Int32" />
                <asp:Parameter Name="cstate" Type="String" />
                <asp:Parameter Name="cno" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
